# coding: utf-8

from sqlalchemy import Column, String, Text, Integer, Date, DateTime, JSON
from marshmallow import Schema, fields
from model.model_base import Base
from sqlalchemy.dialects.postgresql import ARRAY

class BureauWeeklyRepSum(Base):
    # 供电局采集运维工作总结周报
    __tablename__ = 'BureauWeeklyRepSum'
    bureauid = Column(String(2), primary_key=True, comment='供电局编号')
    bureauname = Column(String(50), nullable=True, comment='供电局名称')
    entry_time = Column(DateTime, nullable=True, comment='录入时间')
    weeknum= Column(Integer, primary_key=True, comment='第几周')
    monthnum = Column(Date, primary_key=True, comment='所属月份')
    target_analysis = Column(Text, nullable=True, comment='指标情况分析')
    lastweek_worksum = Column(Text, nullable=True, comment='上周工作总结')
    week_workplan = Column(Text, nullable=True, comment='本周工作计划')
    content_array = Column(JSON, nullable=True, comment='内容json字符串数组')
    teamwork = Column(Text, nullable=True, comment='需要局方协调的问题')
    flag = Column(String(1), comment='审核标志（0正在填报1正在审核2已审核3审核退回）')
    remark = Column(Text, nullable=True, comment='备注，可填写审核未通过原因等')
    entry_openid = Column(String(128), nullable=True, comment='录入人id')
    entry_name = Column(String(50), nullable=True, comment='录入人姓名')
    read_flag = Column(ARRAY(String), nullable=True, comment='阅读字符串数组')


class BureauWeeklyRepSumSchema(Schema):
    bureauid = fields.String()
    bureauname = fields.String()
    entry_time = fields.DateTime(format="%Y-%m-%d %H:%M:%S.%f")
    weeknum = fields.Integer()
    monthnum = fields.Date()
    target_analysis = fields.String()
    lastweek_worksum = fields.String()
    week_workplan = fields.String()
    content_array = fields.List(fields.String())
    teamwork = fields.String()
    flag = fields.String()
    remark = fields.String()
    entry_openid = fields.String()
    entry_name = fields.String()
    read_flag = fields.List(fields.String())

bureauWeeklyRepSumSchema = BureauWeeklyRepSumSchema()
